using System;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Runtime.Serialization;

namespace WcfService1.DTO
{
    [DataContract]
    public class PurchaseOrderDetailDTO : INotifyPropertyChanged
    {
        private Decimal _Discount;
        private String _DiscountType;
        private string _Name;
        private int _No;
        private Decimal _Price;
        private Int32 _PurchaseOrderDetailId;
        private Decimal _Qty;
        private SubGroupDTO _SubGroup;
        private ObservableCollection<SubGroupDTO> _Subgroups;
        private Decimal _TotalDetail;


        [DataMember]
        public Int32 PurchaseOrderDetailId
        {
            get { return _PurchaseOrderDetailId; }
            set
            {
                _PurchaseOrderDetailId = value;
                RaisePropertyChanged("PurchaseOrderDetailId");
            }
        }


      
        [DataMember]
        public SubGroupDTO SubGroup
        {
            get { return _SubGroup; }
            set
            {
                _SubGroup = value;
                RaisePropertyChanged("SubGroup");
            }
        }


        [DataMember]
        public Decimal Qty
        {
            get { return _Qty; }
            set
            {
                _Qty = value;
                RaisePropertyChanged("Qty");
            }
        }


        [DataMember]
        public Decimal Price
        {
            get { return _Price; }
            set
            {
                _Price = value;
                RaisePropertyChanged("Price");
            }
        }


        [DataMember]
        public Decimal Discount
        {
            get { return _Discount; }
            set
            {
                _Discount = value;
                RaisePropertyChanged("Discount");
            }
        }


        [DataMember]
        public String DiscountType
        {
            get { return _DiscountType; }
            set
            {
                _DiscountType = value;
                RaisePropertyChanged("DiscountType");
            }
        }


        [DataMember]
        public Decimal TotalDetail
        {
            get { return _TotalDetail; }
            set
            {
                _TotalDetail = value;
                RaisePropertyChanged("TotalDetail");
            }
        }

        public ObservableCollection<SubGroupDTO> Subgroups
        {
            get { return _Subgroups; }
            set
            {
                _Subgroups = value;
                RaisePropertyChanged("Subgroups");
            }
        }

        public String Name
        {
            get { return _Name; }
            set
            {
                _Name = value;
                RaisePropertyChanged("Name");
            }
        }

        public int No
        {
            get { return _No; }
            set
            {
                _No = value;
                RaisePropertyChanged("No");
            }
        }

        #region INotifyPropertyChanged Members

        public event PropertyChangedEventHandler PropertyChanged;

        #endregion

        protected void RaisePropertyChanged(string propertyname)
        {
            PropertyChangedEventHandler handler = PropertyChanged;
            if (handler != null)
                handler(this, new PropertyChangedEventArgs(propertyname));
        }
    }
}